#include "basemodule.h"

BaseModule::BaseModule(QObject *parent)
    : QObject (parent)
{
    m_mutex = new QMutex(QMutex::Recursive);
}

BaseModule::~BaseModule()
{
    delete m_mutex;
}

uint BaseModule::getMagic()
{
    QMutexLocker locker(m_mutex);
    return (uint)m_id;
}

bool BaseModule::setConfig(int id, QVariant &var)
{
    QMutexLocker locker(m_mutex);
    return true;
}

bool BaseModule::getConfig(int id, QVariant &var)
{
    QMutexLocker locker(m_mutex);
    return true;
}

bool BaseModule::setParam(int id, QVariant &var)
{

}

bool BaseModule::getParam(int id, QVariant &var)
{

}

void BaseModule::setID(ModuleID id)
{
    QMutexLocker locker(m_mutex);
    m_id = id;
}

ModuleID BaseModule::getID(void)
{
    QMutexLocker locker(m_mutex);
    return m_id;
}

void BaseModule::setName(const QString &name)
{
    QMutexLocker locker(m_mutex);
    m_name = name;
}

QString BaseModule::getName() const
{
    QMutexLocker locker(m_mutex);
    return m_name;
}

void BaseModule::setEnable(bool en)
{
    QMutexLocker locker(m_mutex);
    m_enable = en;
}

bool BaseModule::getEnable() const
{
    QMutexLocker locker(m_mutex);
    return m_enable;
}
